<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>智能电表交互记录</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" type="text/css" href="../bootstrap/dist/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/bootstrap-datetimepicker.min.css" />
		<!--<link rel="stylesheet" type="text/css" href="css/public.css" />-->
	</head>
	<style type="text/css">
		.remove {
			cursor: pointer;
		}
		
		.remove:hover {
			color: red;
		}
		
		.pagination span {
			font: 14px/34px "";
			padding: 0 5px;
		}
		
		.form-control {
			display: inline-block;
			width: 120px;
		}
		
		.search {
			width: 155px;
		}
		
		.header {
			/*border-bottom: 1px solid #fefefe;*/
		}
		
		.header span {
			padding: 0 5px;
		}
		
		ul {
			display: block;
			list-style-type: disc;
			margin-block-start: 0em;
			margin-block-end: 0em;
			margin-inline-start: 0px;
			margin-inline-end: 0px;
			padding-inline-start: 0px;
		}
		
		li {
			list-style-type: none;
			display: flex;
			justify-content: flex-start;
			border-bottom: 1px solid #ebebeb;
			font: 14px/28px "";
		}
		
		li span {
			display: inline-block;
			width: 20%;
		}
		
		li p {
			width: 100%;
			text-align: center;
			font: 14px/28px "";
			margin: 0;
		}
		
		.table_cla {
			height: 560px;
		}
	</style>

	<body>
		<div id="app" style="width: 100%; margin: 0 auto;padding:0 20px;">
			<div class="header" style="margin-top: 20px;">
				<!--<span>开始时间:</span>-->
				<input style="width: 150px;" class="form_datetime form-control" type="text" id="datetimepicker" v-model="start" placeholder="请选择开始时间">
				<!--<p>{{start}}</p>-->
				<!--<span>结束时间:</span>-->
				<input style="width: 150px;" class="form_datetime form-control" type="text" id="datetimepicker1" v-model="end" placeholder="请选择结束时间">
				<!--<span>楼宇：</span>-->
				<select name="" class="form-control" v-model="build_model" @change="buildchange">
					<option v-for="index in build" :value="index.id" v-text="index.buildname"></option>
				</select>
				<!--<span>单元：</span>-->
				<select name="" class="form-control" v-model="unit_model" @change="unitchange">
					<option v-for="index in unit" :value="index.id" v-text="index.unitname"></option>
				</select>
				<!--<span>楼层：</span>-->
				<select name="" class="form-control" v-model="floor_model" @change="floorchange">
					<option v-for="index in floor" :value="index.id" v-text="index.floorname"></option>
				</select>
				<!--<span>房号：</span>-->
				<select name="" class="form-control" v-model="room_model">
					<option v-for="index in room" :value="index.rommid" v-text="index.rommcode"></option>
				</select>
				<!--结果-->
				<select name="" class="form-control" v-model="result_model">
					<option v-for="index in result" :value="index.id" v-text="index.name"></option>
				</select>
				<!--操作类型-->
				<select name="" class="form-control" v-model="operate_model">
					<option v-for="index in operate" :value="index.id" v-text="index.name"></option>
				</select>
				<input type="text" class="form-control search" name="search1" id="search1" value="" v-model="searchmain" placeholder="输入需要查询的内容" />

				<button type="button" class="btn btn-info " data-dismiss="modal" @click="search">搜索</button>
				<!--<button type="button" class="btn btn-info" data-dismiss="modal" @click="addMensuo">增加</button>-->
			</div>
			<div class="table_cla">
				<table class="table">
					<caption>智能电表交互记录</caption>
					<thead>
						<tr>
							<th>序号</th>
							<th>楼宇名称</th>
							<th>单元号</th>
							<th>楼层</th>
							<th>房间号</th>
							<th>表号</th>
							<th>表具位置</th>
							<th>查询时间</th>
							<th>余额</th>
							<th>操作类型</th>
							<th>结果 </th>
							<th>详情 </th>
						</tr>
					</thead>
					<tbody>
						<tr v-for="(tt,index) in table">
							<td v-text="index+1"></td>
							<td v-text="tt.buildname"></td>
							<td v-text="tt.units"></td>
							<td v-text="tt.floor"></td>
							<td v-text="tt.rommcode"></td>
							<td v-text="tt.meterid"></td>
							<td v-text="tt.instadr"></td>
							<td v-text="tt.querydate"></td>
							<td v-text="tt.balance"></td>
							<td v-text="tt.operate"></td>
							<td v-text="tt.result"></td>
							<td @click="sure_more(tt)" data-toggle="modal" data-target="#more_model" class="remove">
								<span v-if="panduan" class="glyphicon glyphicon-align-justify"></span>
							</td>
						</tr>
					</tbody>
				</table>

			</div>
			<ul class="pagination">
				<span v-text="count_all"></span>
				<!--<li v-show="current != 1" @click="current-- && goto(current--)">
					<a href="#">上一页</a>
				</li>-->
				<li v-for="index in pages" @click="goto(index)" :class="{'active':current == index}" :key="index">
					<a href="#" v-text="index"></a>
				</li>
				<!--<li v-show="allpage != current && allpage != 0 " @click="current++ && goto(current++)">
					<a href="#">下一页</a>
				</li>-->
				<span>跳到:</span>
				<!--<input style="width: 50px;height: 34px;" min="1" max="{{allpage}}" type="number" name="goto" id="goto" v-model="jump" />-->
				<input style="width: 50px;height: 28px;" name="goto" id="goto" v-model="jump" type="text" name="" oninput="value=value.replace(/[^\d]/g,'')">
				<span>页</span>
				<button type="button" id="gotoo" @click="goto(jump)" class="btn btn-danger ">确定 </button>
			</ul>
			<!-- 模态框（Modal） -->
			<div class="modal fade" id="more_model" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">详细信息</h4>
						</div>
						<div class="modal-body">
							<ul>
								<li>
									<span>ip地址 </span><label v-text="model_data.ipadder"></label>
								</li>
								<li>
									<span>端口号 </span><label v-text="model_data.port"></label>
								</li>
								<li v-if="model_data.powerlimit!=undefined||model_data.price!=undefined||model_data.switchtype!=undefined||model_data.tieredpricing!=undefined">
									<p>请求值</p>
								</li>
								<li v-if="model_data.powerlimit!=undefined">
									<span>功率  </span><label v-text="model_data.powerlimit"></label>
								</li>
								<li v-if="model_data.price!=undefined">
									<span>金额  </span><label v-text="model_data.price"></label>
								</li>

								<li v-if="model_data.switchtype!=undefined">
									<span>开关</span><label v-text="model_data.switchtype"></label>
								</li>
								<li v-if="model_data.tieredpricing!=undefined">
									<span>阶梯价格</span><label v-text="model_data.tieredpricing"></label>
								</li>
								<li v-if="model_data.balance!=undefined||model_data.charegcount!=undefined||model_data.totalprice!=undefined||model_data.current!=undefined||model_data.currentpower!=undefined">
									<p>返回值</p>
								</li>
								<li v-if="model_data.balance!=undefined">
									<span>余额 </span><label v-text="model_data.balance"></label>
								</li>
								<li v-if="model_data.charegcount!=undefined">
									<span>充值次数</span><label v-text="model_data.charegcount"></label>
								</li>
								<li v-if="model_data.totalprice!=undefined">
									<span>总购金额 </span><label v-text="model_data.totalprice"></label>
								</li>
								<li v-if="model_data.current!=undefined">
									<span>电流</span><label v-text="model_data.current"></label>
								</li>
								<li v-if="model_data.currentpower!=undefined">
									<span>瞬时功率 </span><label v-text="model_data.currentpower"></label>
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<!--<button type="button" class="btn btn-danger remove" @click="sureremove">确定删除</button>-->
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!-- 模态框（Modal）提示信息 -->
			<div class="modal fade" id="myModal_tips" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">提示信息</h4>
						</div>
						<div class="modal-body" id="tips" v-text="tips_modal">

						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						</div>
					</div>
				</div>
			</div>
		</div>

	</body>

</html>
<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
<script src="../bootstrap/dist/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/bootstrap-datetimepicker.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/bootstrap-datetimepicker.zh-CN.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/public.js" type="text/javascript" charset="utf-8"></script>
<script>
	//	var urlr = "http://192.168.0.30:8085"
	new Vue({
		el: '#app',
		data: {
			val_te: "",
			urlr: "",
			current: 1,
			showItem: 5,
			count_all: "",
			allpage: "",
			jump: "",
			page_show: false,
			tips_modal: "",
			areaid: "",
			start: "",
			end: "",
			searchmain: "",
			panduan: "",
			merchantid: "",
			result_model: "",
			operate_model: "",
			model_data: "",
			userid: "",
			token: "",
			operate: [{
					id: "",
					name: "操作类型"
				},
				{
					id: 1111,
					name: "读电压"
				}, {
					id: 1112,
					name: "读电流"
				}, {
					id: 1113,
					name: "读功率"
				}, {
					id: 1114,
					name: "销户"
				}, {
					id: 1115,
					name: "读表"
				}, {
					id: 1116,
					name: "充值"
				}, {
					id: 1117,
					name: "设置电价"
				}, {
					id: 1118,
					name: "开合闸"
				}, {
					id: 1119,
					name: "设置功率"
				}, {
					id: 1110,
					name: "开户"
				},
			],
			//			读电压 1111 读电流 1112 读功率 1113 * 销户 1114 读表 1115 充值 1116 * 设置电价1117 开合闸1118设置功率 1119 开户 1110
			result: [{
				id: 10000,
				name: "全部"
			}, {
				id: -1,
				name: "失败"
			}, {
				id: 0,
				name: "查询中"
			}, {
				id: 200,
				name: "成功"
			}, ],
			leixing: [{
				name: '全部',
				id: ""
			}, {
				name: '蓝牙',
				id: "1"
			}, {
				name: '云对讲',
				id: "2"
			}, {
				name: '扫码',
				id: "3"
			}, {
				name: '物业app',
				id: "4"
			}, ],
			leixing_model: "",
			removeid: "",
			floor_model1: "",
			unit_model1: "",
			romm_model1: "",
			build_model1: "",
			build: [{
				buildname: '请选择楼宇',
				id: ""
			}],
			build_model: "",
			unit: [{
				unitname: '请选择单元',
				id: ""
			}],
			unit_model: '',
			floor: [{
				floorname: '请选择楼层',
				id: ""
			}],
			floor_model: '',
			room: [{
				rommcode: '请选择房号',
				rommid: ""
			}],
			room_model: '',
			danyuan_model: '',
			table: [{

				},

			]
		},
		//计算属性
		computed: {

		},
		created: function() {
			var that = this;
			var aa = getUrl();
			that.urlr = aa;
			that.build_model = that.build[0].id;
			that.unit_model = that.unit[0].id;
			that.floor_model = that.floor[0].id;
			that.room_model = that.room[0].rommid;
			that.result_model = that.result[0].id;
			that.operate_model = that.operate[0].id;
		},
		mounted: function() {
			var userid = getUrlParam('userid');
			var createusername = getUrlParam('realname');
			var merchantid = getUrlParam('merchantid');
			this.merchantid = merchantid;
			var areaid = getUrlParam('areaid');
			this.areaid = areaid;
			var token = getUrlParam('token');
			this.token = token;
			var userid = getUrlParam('userid');
			this.userid = userid;
			var createusername = getUrlParam('realname');
			var merchantid = getUrlParam('merchantid');
			this.merchantid = merchantid;
			var areaid = getUrlParam('areaid');
			this.areaid = areaid;
			var token = getUrlParam('token');
			this.token = token;
			if(userid == null || userid == '') {
				//				alert("用户id不能为空")
				this.tips_modal = "用户id不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			if(createusername == null || createusername == '') {
				//				alert("用户姓名不能为空");
				this.tips_modal = "用户姓名不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			if(areaid == null || areaid == '') {
				//				alert("小区id不能为空");
				this.tips_modal = "小区id不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			if(merchantid == null || merchantid == '') {
				//				alert("物业id不能为空");
				this.tips_modal = "物业id不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			this.datePickerInit();
			this.lou_info(this.areaid);
			
			var data_search  = sessionStorage.getItem("data_search");
			if(data_search!=''||data_search!=null){
				data_search = JSON.parse(data_search);
			}			
			if(data_search != ''||data_search!=null) {
				this.build_model = data_search.build;
				this.searchmain = data_search.selectinfo;
				this.romm_model = data_search.rommid;
				this.unit_model = data_search.unitid;
				this.floor_model = data_search.floor;
			}
			if(this.build_model != '') {
				this.build_model1 = this.build_model;
			}
			if(this.romm_model != '') {
				this.romm_model1 = this.romm_model;
			}
			if(this.unit_model != '') {
				this.unit_model1 = this.unit_model;
			}
			if(this.floor_model != '') {
				this.floor_model1 = this.floor_model;
			}
			var datainit = {
				startday: this.start,
				endday: this.end,
				pagenumber: 1,
				pagesize: 10,
				selectinfo: this.searchmain,
				areaid: this.areaid,
				buildid: this.build_model,
				unitid: this.unit_model,
				rommid: this.romm_model,
				floor: this.floor_model,
				result: this.result_model,
				operate: this.operate_model

			}
			if(this.val_te != true) {
				this.jiazai(datainit);
				this.table = ""
			}
			sessionStorage.setItem("data_search", "");
		},
		computed: {
			pages: function() {
				var pag = [];
				if(this.current < this.showItem) { //如果当前的激活的项 小于要显示的条数
					//总页数和要显示的条数那个大就显示多少条
					var i = Math.min(this.showItem, this.allpage);
					while(i) {
						pag.unshift(i--);
					}
				} else { //当前页数大于显示页数了
					var middle = this.current - Math.floor(this.showItem / 2), //从哪里开始
						i = this.showItem;
					if(middle > (this.allpage - this.showItem)) {
						middle = (this.allpage - this.showItem) + 1
					}
					while(i--) {
						pag.push(middle++);
					}
				}
				return pag
			},

		},
		methods: {
			//获取楼宇
			lou_info: function(areaid) {
				var that = this;
				var data = JSON.stringify({
					parentid: that.areaid
				})
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/public/selectBuildList",
					data: data,
					async: true,
					dataType: "json",
					success: function(msg) {
						//						console.log(msg);
						if(msg.code == 200) {
							var aa = JSON.parse(msg.returnString);
							var te = {
								buildname: '请选择楼宇',
								id: ""
							}
							aa.unshift(te);
							that.build = aa;
							if(that.build_model1) {
								that.build_model = that.build_model1;
								that.unil_info(that.build_model)
							} else {
								that.build_model = that.build[0].id;
							}

						} else {
							//							alert(msg.disp)
							that.tips_modal = msg.disp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						//						alert("获取信息失败");
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//楼改变请求单元
			buildchange: function() {
				this.unil_info(this.build_model);
			},
			//获取单元
			unil_info: function(areaid) {				
				if(areaid != "") {
					var that = this;
					var data = JSON.stringify({
						parentid: areaid
					})
					$.ajax({
						contentType: "application/json; charset=utf-8",
						type: "POST",
						url: that.urlr + "/public/selectUnitsList",
						data: data,
						async: true,
						dataType: "json",
						success: function(msg) {
							//							console.log(msg);
							if(msg.code == 200) {
								var aa = JSON.parse(msg.returnString);
								var te = {
									unitname: '请选择单元',
									id: ""
								}
								aa.unshift(te);
								that.unit = aa;
								if(that.unit_model1) {
									that.unit_model = that.unit_model1;
									that.floor_info(that.unit_model)
								} else {
									that.unit_model = that.unit[0].id;
								}
								
							} else {
								//							alert(msg.disp)
								that.tips_modal = msg.disp;
								$('#myModal_tips').modal('show');
							}
						},
						error: function() {
							//						alert("获取信息失败");
							that.tips_modal = "获取信息失败";
							$('#myModal_tips').modal('show');
						}
					});
				}

			},
			/*单元改变*/
			unitchange: function() {
				this.floor_info(this.unit_model);
			},
			//获取楼层
			floor_info: function(areaid) {
				if(areaid != "") {
					var that = this;
					var data = JSON.stringify({
						parentid: areaid
					})
					$.ajax({
						contentType: "application/json; charset=utf-8",
						type: "POST",
						url: that.urlr + "/public/selectFloors",
						data: data,
						async: true,
						dataType: "json",
						success: function(msg) {
							//							console.log(msg);
							if(msg.code == 200) {
								var aa = JSON.parse(msg.returnString);
								var te = {
									floorname: '请选择楼层',
									id: ""
								}
								var flloor = [];
								for(var i = 1; i <= aa; i++) {
									var main = {
										floorname: i + "层",
										id: i
									}
									flloor.push(main)
								}
								flloor.unshift(te);
								that.floor = flloor;
//								debugger
								if(that.floor_model1) {
									that.floor_model = that.floor_model1;
									that.room_info(that.unit_model,that.floor_model);									
								} else {
									that.floor_model = that.floor[0].id;
								}
								
							} else {
								//							alert(msg.disp)
								that.tips_modal = msg.disp;
								$('#myModal_tips').modal('show');
							}
						},
						error: function() {
							//						alert("获取信息失败");
							that.tips_modal = "获取信息失败";
							$('#myModal_tips').modal('show');
						}
					});
				}

			},
			//楼层改变
			floorchange: function() {
				var that = this;
				if(this.unit_model == '' || this.floor_model == '') {
					var aa = [];
					var te = {
						rommcode: '请选择房号',
						rommid: ""
					}
					aa.unshift(te);
					that.room = aa;
					that.room_model = that.room[0].rommid;
				} else {
					this.room_info(this.unit_model, this.floor_model);
				}
			},
			//出现房屋
			room_info: function(areaid, floor_c) {
				if(areaid != "" || floor_c != "") {
					var that = this;
					var data = JSON.stringify({
						parentid: areaid,
						floor: floor_c
					})
					$.ajax({
						contentType: "application/json; charset=utf-8",

						type: "POST",
						url: that.urlr + "/public/selectRoomCodeList",
						data: data,
						async: true,
						dataType: "json",
						success: function(msg) {
							//							console.log(msg);
							if(msg.code == 200) {
								var aa = JSON.parse(msg.returnString);
								var te = {
									rommcode: '请选择房号',
									rommid: ""
								}
								aa.unshift(te);
								that.room = aa;
								if(that.romm_model1) {									
									that.room_model = that.romm_model1;																	
								} else {
									that.room_model = that.room[0].rommid;
								}
								
							} else {
								that.tips_modal = msg.disp;
								$('#myModal_tips').modal('show');
							}
						},
						error: function() {
							that.tips_modal = "获取信息失败";
							$('#myModal_tips').modal('show');
						}
					});
				}
			},

			datePickerInit: function() {
				//debugger
				var d, s;
				var self = this;
				self.start = s;
				$('#datetimepicker').datetimepicker({
					//					minView: "month", //选择日期后，不会再跳转去选择时分秒 
					language: 'zh-CN',
					format: 'yyyy-mm-dd hh:ii ',
					todayBtn: 1,
					autoclose: 1,
				});
				$('#datetimepicker1').datetimepicker({
					startDate: s,
					//					minView: "month", //选择日期后，不会再跳转去选择时分秒 
					language: 'zh-CN',
					format: 'yyyy-mm-dd hh:ii',
					todayBtn: 1,
					autoclose: 1,
				});
				$('#datetimepicker').datetimepicker()
					.on('hide', function(ev) {
						var value = $("#datetimepicker").val();
						self.start = value;
						$('#datetimepicker1').datetimepicker('setStartDate', self.start);
						self.end = "";
					});
				$('#datetimepicker1').datetimepicker()
					.on('hide', function(ev) {
						var value = $("#datetimepicker1").val();
						self.end = value;

					});
			},

			remove: function($event) {
				var this1 = $event.currentTarget;
				var sss = this1.children[1].innerHTML;
				this.removeid = sss;
				//				console.log(this.removeid)
			},
			//加载数据
			jiazai: function(e) {
				var data = JSON.stringify(e);
				var that = this;
				//				console.log(data)
				//				console.log(that.userid)
				//				console.log(that.token)
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/elepro/selectQueryList",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						//						console.log(msg);
						if(msg.code == 200) {
							var data = JSON.parse(msg.returnString);

							for(var i = 0; i < data.length; i++) {
								//								读电压       1111       读电流      1112       读功率      1113      * 销户        1114      读表        1115      充值        1116      * 设置电价1117 开合闸1118设置功率    1119 开户 1110
								if(data[i].operate == 1111) {
									data[i].operate = "读电压  "
								} else if(data[i].operate == 1112) {
									data[i].operate = "读电流"
								} else if(data[i].operate == 1113) {
									data[i].operate = "读功率"
								} else if(data[i].operate == 1114) {
									data[i].operate = "销户 "
								} else if(data[i].operate == 1115) {
									data[i].operate = "读表"
								} else if(data[i].operate == 1116) {
									data[i].operate = "充值 "
								} else if(data[i].operate == 1117) {
									data[i].operate = "设置电价"
								} else if(data[i].operate == 1118) {
									data[i].operate = "开合闸"
								} else if(data[i].operate == 1119) {
									data[i].operate = "设置功率"
								} else if(data[i].operate == 1110) {
									data[i].operate = "开户"
								}
								//								结果 0查询中 200成功 203 跟表通讯失败 204表返回数据不正确 212超出查询次数  201缺少参数 202验签失败211未找到该查询id   
								if(data[i].result == 0) {
									data[i].result = "查询中  "
								} else if(data[i].result == 200) {
									data[i].result = "成功"
								} else if(data[i].result == 203) {
									data[i].result = "跟表通讯失败"
								} else if(data[i].result == 204) {
									data[i].result = "表返回数据不正确 "
								} else if(data[i].result == 212) {
									data[i].result = "超出查询次数"
								} else if(data[i].result == 201) {
									data[i].result = "缺少参数 "
								} else if(data[i].result == 202) {
									data[i].result = "验签失败 "
								} else if(data[i].result == 211) {
									data[i].result = "未找到该查询id "
								}

							}

							that.table = data;
							if(that.table.length > 0) {
								that.panduan = true;
								//								that.page_show = true;
							} else {
								that.panduan = false;
							}
							//							//	
							that.count_all = "共" + msg.count + "条";
							var yu = msg.count % 10;
							if(yu == 0) {
								that.allpage = parseInt(msg.count / 10);
							} else {
								that.allpage = parseInt(msg.count / 10) + 1;
							}

						} else {
							//							alert(msg.disp)
							that.tips_modal = msg.disp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						//						alert("获取信息失败");
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});

			},

			sureremove: function() {
				//				debugger
				var that = this;
				var aa = that.removeid;
				var data = {
					"doorlockid": aa
				}
				data = JSON.stringify(data);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/doorLock/deleteDoorLock",
					data: data,
					async: true,
					dataType: "json",
					success: function(msg) {
						//						console.log(msg);
						if(msg.code == 200) {
							//							alert("删除成功");
							$('#myModalremove').modal('hide');
							that.tips_modal = "删除成功";
							$('#myModal_tips').modal('show');
							var datainit = {
								"startday": that.start,
								"endday": that.end,
								"organizeid": "",
								"pagenumber": 1,
								"pagesize": 10
							}
							that.jiazai(datainit);
						} else {
							//							alert(msg.disp)
							that.tips_modal = msg.disp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						//						alert("获取信息失败");
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			goto: function(index) {
				if(index == this.current) return;
				if(index > this.allpage) {
					return
				}
				//				debugger
				var re = /^[1-9]+[0-9]*]*$/ //判断正整数      // /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字  
				if(!re.test(index)) {
					return false;
				}
				this.current = index;

				var datainit = {
					startday: this.start,
					endday: this.end,
					pagenumber: index,
					pagesize: 10,
					selectinfo: this.searchmain,
					areaid: this.areaid,
					buildid: this.build_model,
					unitid: this.unit_model,
					rommid: this.romm_model,
					floor: this.floor_model,
					result: this.result_model,
					operate: this.operate_model
				}
				this.jiazai(datainit);
				//这里可以发送ajax请求
			},
			search: function() {
				var that = this;
				var datainit = {
					startday: this.start,
					endday: this.end,
					pagenumber: 1,
					pagesize: 10,
					selectinfo: this.searchmain,
					areaid: this.areaid,
					buildid: this.build_model,
					unitid: this.unit_model,
					rommid: this.romm_model,
					floor: this.floor_model,
					result: this.result_model,
					operate: this.operate_model
				}
				if(that.val_te != true) {
					this.jiazai(datainit);
					that.current=1;
				} else {
					//					alert("非法登录");
					that.tips_modal = "非法登录";
					$('#myModal_tips').modal('show');
				}

			},
			sure_more: function(data) {
				var that = this;
				that.model_data = data;
				//				console.log(that.model_data.powerlimit)
			},

		},

	})
</script>